/*
 * GameState.java
 * Copyright January 26, 2013 Erik Strelzoff
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.magelord.model;

import java.util.HashMap;
import java.util.Map;

/**
 *
 */
public class GameState extends MLObject {
	
//- Map
//- Sides
//- Players
	
//- ID Management
//- Master object maps.  Map of IDs to game object.  Unit?

	private final Map<Integer,Unit> m_unitMap = new HashMap<Integer,Unit>();
	
	/**
	 * For ID assignment.  Assigns IDs unit to a particular game.
	 */
	private int m_lastId = 0;
	
	public GameState() {
	}
	
	/**
	 * Retrieve a unit from the GameState by ID.  Returns null if not found.
	 */
	public Unit getUnit(int id) {
		return m_unitMap.get(id);
	}
	
	/**
	 * Retrieve the next ID which is unique to this game.
	 */
	public synchronized int nextId() {
		return m_lastId++;
	}
}
